#include <iostream>


/**
 * 
 * 时间复杂度：O(1)
 * 空间复杂度：O(1)
 * 
 * 回文数字
 */
using namespace std;
int main() {
    int n, ok = 0;
    cin >> n;
    for (int i = 1; i <= 9; i++) {
        for (int j = 0; j <= 9; j++) {
            for (int k = 0; k <= 9; k++) {
                if (i + j + k + j + i == n) {
                    int ans = i * 10001 + j * 1010 + k * 100;
                    ok = 1;
                    cout << ans << endl;
                }
            }
        }
    }
    for (int i = 1; i <= 9; i++) {
        for (int j = 0; j <= 9; j++) {
            for (int k = 0; k <= 9; k++) {
                if (i + j + k + k + j + i == n) {
                    int ans = i * 100001 + j * 10010 + k * 1100;
                    ok = 1;
                    cout << ans << endl;
                }
            }
        }
    }
    if (ok == 0) {
        cout << -1 << endl;
    }
    return 0;
}